<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
  <style>
.box {
    width: 200px;
    height: 100px;
    background-color: skyblue;
    position: relative; /* 相对定位 */
}
.item {
    width: 50px;
    height: 50px;
    background-color: tomato;
    position: absolute; /* 绝对定位 */
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    margin: auto; /* 外边距特殊场景应用 */
}
</style>
</head>
<body>
<div class="box">
<div class="item"></div>
</div>
</body>
</html>
